import matplotlib.pyplot as plt
from pywaffle import Waffle
plt.rcParams['font.sans-serif'] = 'SimHei'
data = {'上座': 150, '空座': 50}
total = sum(list(data.values()))
plt.figure(
    FigureClass=Waffle, rows=10, columns=10,
    values=data, vertical=True,
    title={'label': '某电影上座率华夫饼图'},
    #设置图例的文本、位置、列数，以及不显示图例边框
    legend={
        'labels': [
            '({}){:.0f}%'.format(k, 100*v/total) for k, v in data.items()
        ],
        'bbox_to_anchor': (0.85, -0.1),
        'ncol': 2,
        'frameon': False
    }
)
plt.show()